#include<iostream>
#include<vector>
using namespace std;

int main()
{
    int n;
    cin >> n;
   // int ret[15][15];
    vector<vector<int>> ret(n+1);
    for (int i = 0; i < n; i++)
    {
        ret[i].resize(n+1);
    }
    int c = 1, k = 0, l = n - 1;
    while (k <= l)
    {
        for (int j = k; j <= l; j++)
            ret[k][j] = c++;
        for (int j = k + 1; j <= l; j++)
            ret[j][l] = c++;
        for (int j = l - 1; j >= k; j--)
            ret[l][j] = c++;
        for (int j = l - 1; j > k; j--)
            ret[j][k] = c++;
        k++;
        l--;

    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            printf("%3d", ret[i][j]);
        }
        cout << endl;
    }
    return 0;
}